<?php
/* Encapsulation de HtmlPurifier */
require_once (realpath(dirname(__FILE__)) . '/htmlpurifier/HTMLPurifier.auto.php');

require_once(realpath(dirname(__FILE__)) . "/../classes/actions/ActionsModules.class.php");

class TheliaPurifier {

	private static $instance = false;

	private static $purifier = false;

	private function __construct() {

		$config = HTMLPurifier_Config::createDefault();
		$config->set('Core.Encoding', "UTF-8");

		ActionsModules::instance()->appel_module("htmlpurifierinit");

		self::$purifier = new HTMLPurifier($config);
	}

	public static function instance() {
		if (self::$instance === false) {
			self::$instance = new TheliaPurifier();
		}

		return self::$instance;
	}

	public function purifier($texte) {
		return self::$purifier->purify($texte);
	}
}
?>